let http = require('http');

/**
 * 构造http1.0，删除头信息的host
 * @type {http.ClientRequest._storeHeader}
 */
const clientRequestStoreHeader = http.ClientRequest.prototype._storeHeader;
http.ClientRequest.prototype._storeHeader = function () {
    this.httpVersion = '1.0';
    arguments[0] = arguments[0].slice(0, -3) + '0\r\n';
    delete arguments[1];
    clientRequestStoreHeader.apply(this, arguments);
};

let options = {
    hostname: '127.0.0.1',
    port: 3000,
    path: '/ikejcwang/syaHello?method=sayHello',
    method: 'POST'
};

let req = http.request(options, function (res) {
    console.log('STATUS: ' + res.statusCode);
    console.dir(res.headers);

    res.on('data', function (chunk) {
        console.log('BODY: ' + chunk);
    });
});
req.on('error', function (e) {
    console.log('problem with request_test: ' + e.message);
});

req.end('hello http1.0 version');
